Page({
  data: {
    words: [
      {
        id: 1,
        word: 'apple',
        correct: false
      },
      {
        id: 2,
        word: 'banana',
        correct: false
      }
    ]
  },
  checkWriting(e) {
    const wordId = e.currentTarget.dataset.id;
    const answer = e.detail.value;
    const words = this.data.words;
    const index = words.findIndex(word => word.id === wordId);
    if (words[index].word === answer) {
      words[index].correct = true;
    } else {
      words[index].correct = false;
    }
    this.setData({
      words
    });
  }
})